package top.scauwlt.serialize;

import top.scauwlt.extension.SPI;

/**
 * @Author wmm
 * @Date 2022/7/22 11:02
 */
@SPI
public interface Serializer {
    /**
     * 将对象序列化为byte数组
     *
     * @param obj
     * @return
     */
    byte[] serialize(Object obj);

    /**
     * 将数组反序列化为对象
     *
     * @param bytes
     * @param clazz
     * @param <T>
     * @return
     */
    <T> T deserialize(byte[] bytes, Class<T> clazz);
}
